import unittest
from htmltestreport import HTMLTestReport

from config import BASE_PATH, init_log_config

if __name__ == '__main__':
    # 初始化日志
    init_log_config()

    # 2. 生成测试套件
    suite = unittest.defaultTestLoader.discover(BASE_PATH + '/scripts', 'test*')

    # 3. 实例化HTMLTestRunner对象
    report = HTMLTestReport(BASE_PATH+'/report/report.html',
                            title="p2pApiAutoTest测试报告",
                            description="V1.0")

    # 4. 执行测试套件
    report.run(suite)
